import request from "@/utils/request";

export function categoryList() {
    return request({
        url: "/category/listAll", method: "get",
    });
}

// 分页查询category列表
export function listCategoryByPage(query) {
    return request({
        url: '/category/page',
        method: 'get',
        params: query
    })
}

// 根据categoryId 删除列表
export function deleteCategory(categoryId) {
    return request({
        url: '/category/delete/' + categoryId,
        method: 'delete'
    })
}

// 根据id查询 整个form
export function getCategoryById(categoryId) {
    return request({
        url: '/category/' + categoryId,
        method: 'get'
    })
}

// 修改category 提交
export function updateCategory(data) {
    return request({
        url: 'category/',
        method: 'put',
        data: data
    })
}

// 新增产品
export function addCategory(data) {
    return request({
        url: 'category/',
        data: data,
        method: 'post'
    })
}